<form action="show_payment" method="post">
<select name="time">
    <?php foreach ($query as $rows)
    {?>
    <option value="<?=$rows->payment_month?>"><?php echo $rows->payment_month?></option>
    <?php
    }
?>
    <input type="submit" value="Show">
    <?php if(isset($error_mg)) echo $error_mg;?>
</form>
</select>